/*
package com.yxjr.project.ws;

import javax.annotation.Resource;
import javax.jws.WebService;

import com.ipan.core.utils.reflection.BeanHelper;
import com.yxjr.project.component.ClientMessage;
import com.yxjr.project.entity.MGCheckMsg;
import com.yxjr.project.mapper.MGCheckMsgMapper;
import org.dom4j.Document;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;


import java.util.Iterator;
import java.util.List;

@WebService(endpointInterface = "com.yxjr.project.ws.IMGClient")
public class MGClient implements IMGClient {

    Exception e
    @Resource
    private MGCheckMsgMapper checkMapper;

    @Override
    public String sheetSta(String sheetId) {
        // TODO Auto-generated method stub
        ClientMessage msg = new ClientMessage();

        try {
            Document document = null;
            document = DocumentHelper.parseText(sheetId);
            Element root = document.getRootElement();
            Element pub = root.element("pub");
            Element req = root.element("req");
            Element ans = root.element("ans"); // 可以为空
            Iterator<?> iter = null;
            // 解析pub
            iter = pub.elements().iterator();
            while (iter.hasNext()) {
                Element item = (Element) iter.next();
                String emName = item.getName();
                String emText = item.getTextTrim();
                BeanHelper.setBeanValueOfStrict(msg, emName, emText);
            }
            //解析req域
            if (req == null) {
                return sheetId;
            }
            iter = req.elements().iterator();
            while (iter.hasNext()) {
                Element item = (Element) iter.next();
                String emName = item.getName();
                String emText = item.getTextTrim();
                BeanHelper.setBeanValueOfStrict(msg, emName, emText);
                if (!emName.equals("checkSheet")) {
                    return sheetId;
                }
                Element css = item.element("checkSheet");
                Element starTime = item.element("lastUpdateTimeFrom");
                Element endTime = item.element("lastUpdateTimeTo");

                //当checkSheet为空，根据时间获取信息
                if (css == null) {
                    String star = starTime.getTextTrim();
                    String end = endTime.getTextTrim();
                    List<MGCheckMsg> list = checkMapper.selectByTime(star, end);
                    return getString(msg.getTxcode(), list);
                }
                //当checkSheet不为空
                String checkSheet = css.getTextTrim();
                //根据报账单编号查询报账单信息
                List<MGCheckMsg> list = checkMapper.getCheckById(checkSheet);
                return getString(msg.getTxcode(), list);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return sheetId;
    }

    private String getString(String txCode, List<MGCheckMsg> list) {
        if (list == null || list.isEmpty()) {
            return null;
        }
        for (int i = 0; i < list.size(); i++) {
            MGCheckMsg msg = list.get(0);
            StringBuilder buf = new StringBuilder();
            buf.append("<?xml version=\"1.0\" encoding=\"GBK\" standalone=\"no\"?>");
            buf.append("<package>");
            buf.append("<pub>");
            buf.append("<txcode>").append(txCode).append("</txcode>");
            buf.append("<retcode>").append("").append("</retcode>");
            buf.append("<retmsg>").append("").append("</retmsg>");
            buf.append("<ansList>");
            buf.append("<checkSheet>");
            buf.append(msg.getChecksheetid());
            buf.append("</checkSheet>");
            buf.append("<expressNo>");
            buf.append("");
            buf.append("</expressNo>");
            buf.append("<siteName>");
            buf.append(msg.getSitename());
            buf.append("</siteName>");
            buf.append("<deliver>");
            buf.append(msg.getPersonid());
            buf.append("</deliver>");
            buf.append("<sender>");
            buf.append(msg.getPersonid());
            buf.append("</sender>");
            buf.append("<fetchPerson>");
            buf.append("");
            buf.append("</fetchPerson>");
            buf.append("<lastUpdateTime>");
            buf.append(msg.getOperation_time());
            buf.append("</lastUpdateTime>");
            buf.append("</ansList>");
            buf.append("</package>");
            return buf.toString();
        }
        return null;
    }


    @Override
    public String clientVideo(String req) {
        // TODO Auto-generated method stub
        return req + 90101;
    }
}
*/
